home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 May / CHIP Mayıs 1997.iso / qtools / vis / vis.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-12  |  2.3 KB  |  126 lines

  1. // vis.h
  2.  
  3. #include "cmdlib.h"
  4. #include "mathlib.h"
  5. #include "bspfile.h"
  6.  
  7. #define    MAX_PORTALS    32768
  8.  
  9. #define    PORTALFILE    "PRT1"
  10.  
  11. #define    ON_EPSILON    0.1
  12.  
  13. typedef struct
  14. {
  15.     vec3_t        normal;
  16.     float        dist;
  17. } plane_t;
  18.  
  19. typedef struct
  20. {
  21.     qboolean    original;            // don't free, it's part of the portal
  22.     int        numpoints;
  23.     vec3_t    points[8];            // variable sized
  24. } winding_t;
  25.  
  26. #define MAX_POINTS_ON_WINDING    64
  27.  
  28. winding_t    *NewWinding (int points);
  29. void        FreeWinding (winding_t *w);
  30. winding_t *ClipWinding (winding_t *in, plane_t *split, qboolean keepon);
  31. winding_t    *CopyWinding (winding_t *w);
  32.  
  33.  
  34. typedef enum {stat_none, stat_working, stat_done} vstatus_t;
  35. typedef struct
  36. {
  37.     plane_t        plane;    // normal pointing into neighbor
  38.     int            leaf;    // neighbor
  39.     winding_t    *winding;
  40.     vstatus_t    status;
  41.     byte        *visbits;
  42.     byte        *mightsee;
  43.     int            nummightsee;
  44.     int            numcansee;
  45. } portal_t;
  46.  
  47. typedef struct seperating_plane_s
  48. {
  49.     struct seperating_plane_s *next;
  50.     plane_t        plane;        // from portal is on positive side
  51. } sep_t;
  52.  
  53.  
  54. typedef struct passage_s
  55. {
  56.     struct passage_s    *next;
  57.     int            from, to;        // leaf numbers
  58.     sep_t                *planes;
  59. } passage_t;
  60.  
  61. #define    MAX_PORTALS_ON_LEAF        128
  62. typedef struct leaf_s
  63. {
  64.     int            numportals;
  65.     passage_t    *passages;
  66.     portal_t    *portals[MAX_PORTALS_ON_LEAF];
  67. } leaf_t;
  68.  
  69.     
  70. typedef struct pstack_s
  71. {
  72.     struct pstack_s    *next;
  73.     leaf_t        *leaf;
  74.     portal_t    *portal;    // portal exiting
  75.     winding_t    *source, *pass;
  76.     plane_t        portalplane;
  77.     byte        *mightsee;        // bit string
  78. } pstack_t;
  79.  
  80. typedef struct
  81. {
  82.     byte        *leafvis;        // bit string
  83.     portal_t    *base;
  84.     pstack_t    pstack_head;
  85. } threaddata_t;
  86.  
  87.  
  88. #ifdef __alpha
  89. #include <pthread.h>
  90. extern    pthread_mutex_t    *my_mutex;
  91. #define    LOCK    pthread_mutex_lock (my_mutex)
  92. #define    UNLOCK    pthread_mutex_unlock (my_mutex)
  93. #else
  94. #define    LOCK
  95. #define    UNLOCK
  96. #endif
  97.  
  98.  
  99. extern    int            numportals;
  100. extern    int            portalleafs;
  101.  
  102. extern    portal_t    *portals;
  103. extern    leaf_t        *leafs;
  104.  
  105. extern    int            c_portaltest, c_portalpass, c_portalcheck;
  106. extern    int            c_portalskip, c_leafskip;
  107. extern    int            c_vistest, c_mighttest;
  108. extern    int            c_chains;
  109.  
  110. extern    byte    *vismap, *vismap_p, *vismap_end;    // past visfile
  111.  
  112. extern    qboolean        showgetleaf;
  113. extern    int            testlevel;
  114.  
  115. extern    byte        *uncompressed;
  116. extern    int            bitbytes;
  117. extern    int            bitlongs;
  118.  
  119.  
  120. void LeafFlow (int leafnum);
  121. void BasePortalVis (void);
  122.  
  123. void PortalFlow (portal_t *p);
  124.  
  125. void CalcAmbientSounds (void);
  126.